﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link type="text/css" href="/CSS/Main.css" rel="stylesheet" />
    <link type="text/css" href="/App_Themes/MSN_Blue/default.css" rel="stylesheet" />
    <link type="text/css" href="/App_Themes/MSN_Blue/menu.css" rel="stylesheet" />
    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
            border: 0;
            width: 100%;
        }
    </style>
    <script src="https://cdn.bootcss.com/jquery/1.11.1/jquery.js" type="text/javascript"></script>
</head>
<body>
    <div>
        <div style="width: 100%">
            <div id="table1_title" style="margin: 20px; text-align: center;">
                周资金详情
            </div>
        </div>
        <div style="width: 100%;">
            <div id="table1" style="margin: 20px; text-align: center;">
            </div>
        </div>
    </div>
    <script type="text/javascript">
        if (typeof window.GetRequest != 'undefined') {
            top.MessageBox.Alert("GetRequest参数 属性名已被占用");
        }
        else {
            window.GetRequest = function (ifObj) {
                if (typeof ifObj == 'boolean') {
                    if (ifObj) {
                        var obj = {};
                        obj.Data = GetRequest();
                        obj.QueryString = function (key) {
                            for (var item in obj.Data) {
                                if (item.toLocaleLowerCase() == key.toLocaleLowerCase()) {
                                    return obj.Data[item];
                                }
                            }
                            return '';
                        }
                        return obj;
                    }
                }
                var url = location.search; //获取url中"?"符后的字串
                var theRequest = new Object();
                if (url.indexOf("?") != -1) {
                    var str = url.substr(1);
                    strs = str.split("&");
                    for (var i = 0; i < strs.length; i++) {
                        theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
                    }
                }
                return theRequest;
            }
        }
        Date.prototype.format = function (fmt) {
            var o = {
                "M+": this.getMonth() + 1,                 //月份
                "d+": this.getDate(),                    //日
                "h+": this.getHours(),                   //小时
                "m+": this.getMinutes(),                 //分
                "s+": this.getSeconds(),                 //秒
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                "S": this.getMilliseconds()             //毫秒
            };
            if (/(y+)/.test(fmt)) {
                fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            }
            for (var k in o) {
                if (new RegExp("(" + k + ")").test(fmt)) {
                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                }
            }
            return fmt;
        }
    </script>
    <script type="text/javascript">
        $(function () {
            var parms = {};
            parms.Type = "WEEK_TABLE";
            parms.Data = { ID: GetRequest(true).QueryString("ID") };
            $.ajax({
                url: "/Module/StatisticalReport/api.ashx", async: true, type: "POST", data: JSON.stringify(parms), success: function (data) {
                    if (data.Success)
                        var option = {};
                        var entity = data.Entity;
                        $("#table1_title").text(entity.N_YEAR + "年" + entity.N_MONTH + "月第" + entity.N_WEEK + "周资金详情");
                        option.cols = [
                            {
                                Name: "ACCOUNT_FLOW",
                                Text: "交易流水号", Format: function (row, index) {
                                    return row["ACCOUNT_FLOW"] == "" ? "-" : row["ACCOUNT_FLOW"];
                                }
                            },
                            {
                                Name: "FLAG",
                                Text: "交易类型",
                                Format: function (row, index) {
                                    return row["FLAG"] ? "转出" : "转入";
                                }
                            },
                            {
                                Name: "BANK_NAME",
                                Text: "银行"
                            },
                            {
                                Name: "ACCOUNT_NAME",
                                Text: "对方账户名称"
                            },
                            {
                                Name: "ACCOUNT",
                                Text: "对方账号"
                            },
                            {
                                Name: "MONEY",
                                Text: "发生额",
                                Format: function (row, index) {
                                    return row["MONEY"] +"元";
                            }
                            },
                            {
                                Name: "SCOP_DATE",
                                Text: "银行流水时间",
                                Format: function (row, index) {
                                    var oldTime = (new Date(row["SCOP_DATE"])).format("yyyy年MM月dd日");
                                    return oldTime;
                                }
                            },
                            {
                                Name: "REMARK",
                                Text: "备注"
                            }
                        ];
                        option.data = data.Data;
                        option.dom = $("#table1");
                        top.DataTable(option);
                }
            });
        })
    </script>
</body>
</html>